﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddLineFromLastDraw.ascx.cs" Inherits="BigLotterySyndicate.Secured.Draws.Controls.AddLineFromLastDraw" %>
<asp:MultiView ID="MultiViewList" runat="server">
<asp:View ID="ViewList" runat="server">
<p>Number of lines that can be added to this draw: <strong><%= PrintLinesRemaining() %></strong></p>
<table cellpadding="2" cellspacing="2" style="float:left" border="0">
    <tr>
        <td>Select all</td>
        <td>
            <script type="text/javascript">
                document.write("<input type='checkbox' id='CheckboxToggleParent' onclick='ToggleAllCheckboxes(this)'/>");

                function ToggleAllCheckboxes(el) {
                    var state = el.checked;
                    while (el && el.tagName.toLowerCase() != "table") {
                        el = el.parentNode;
                    }
                    if (el) {
                        var inputs = el.getElementsByTagName("input");
                        for (var idx = 0; idx < inputs.length; idx++) {
                            if (inputs[idx].id != "CheckboxToggleParent" && inputs[idx].type.toLowerCase() == "checkbox")
                                inputs[idx].checked = state;
                        }
                    }
                }
                            </script>
                            <noscript>&nbsp;</noscript>
</th>

        </td>
    </tr>
<tbody>
<asp:Repeater ID="RepeaterList" runat="server">
    <ItemTemplate>
    <tr>
    <td><%# Container.ItemIndex+1 %>.</td>
    <td>
    <%# PrintNumbers(Container.DataItem) %>
    </td>
    <td>
    <asp:PlaceHolder ID="PlaceHolderAction" runat="server">
    <input type="checkbox" runat="server" id="chkAction"/>
    </asp:PlaceHolder>
    </td>
    </tr>  
    </ItemTemplate>       
</asp:Repeater>
</tbody>
</table>
<p></p>
<p style="float:left; width:100%;">
<asp:Button ID="ButtonAdd" runat="server" Text="Add selected lines" 
        onclick="ButtonAdd_Click" />
</p>
</asp:View>
<asp:View ID="ViewEmpty" runat="server">
<p>No lines found.</p>
</asp:View>
</asp:MultiView>